home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 20
/
Cream of the Crop 20 (Terry Blount) (1996).iso
/
math
/
eval.zip
/
CALC.CLA
next >
Wrap
Text File
|
1996-04-02
|
2KB
|
58 lines
Program
map
Module('Eval')
Eval(STRING,*BYTE),REAL
.
.
Aexp string(100)
Ae string(100)
Result real
Err byte
SCREEN SCREEN(18,78),CENTER,SHADOW,COLOR(112)
ROW(5,64) PAINT(1,9),COLOR(48)
ROW(1,1) STRING('█{78}'),COLOR(113)
ROW(3,11) STRING('This program "knows" these math. functions & constants :')
ROW(4,7) STRING('Sin, Cos, Tan, Cotg, ASin, ACos, ATan, Exp, LogE, Log10, Abs, Int,'),COLOR(48)
ROW(5,7) STRING('Sqrt, Sign, Fact, Inv, +, -, *, /, ^ (or **), (), Pi, e .'),COLOR(48)
ROW(6,7) STRING('Function with two parameters :')
COL(38) STRING('bAnd, bOr, bXor, bShift'),COLOR(48)
COL(62) STRING('.')
ROW(8,3) STRING('Your expression may contain max. 50 chars, the result is a type of Real.')
ROW(9,3) STRING('Example : Enter : 3+4*5*(1-SIN(30*PI/180))-FACT(SQRT(25)-2)*BSHIFT(3,-1)')
ROW(10,13) STRING('Result : 7')
ROW(12,3) STRING('Enter expression :')
ROW(13,14) STRING('Error :')
ROW(14,13) STRING('Result :')
ROW(17,27) STRING('Press Ctrl+Esc to finish')
ROW(18,1) STRING('█▄{76}█'),COLOR(113)
REPEAT(16)
ROW(2,1) STRING('█'),COLOR(113)
ROW(2,78) STRING('█'),COLOR(113)
.
ROW(13,22) ENTRY(@n2),USE(Err),SKIP,COLOR(126,127,0)
ROW(12,22) ENTRY(@s50),USE(Ae),COLOR(126,7,120)
ROW(14,22) ENTRY(@n-23.10),USE(Result),SKIP,COLOR(126,7,120)
.
Code
! Ae = '3+4*5*(1-sin(30*pi/180))-fact(sqrt(25)-2)*bshift(3,-1)'
Alert(279)
Open(Screen)
! display
loop
accept
if KeyCode() = 279 then break.
Result = Eval(Ae,Err)
display
select(?)
.
Close(Screen)
Return